package cn.gson.crm.model.pojo;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the TIME_DEAL database table.
 * 
 */
@Entity
@Table(name="TIME_DEAL")
@NamedQuery(name="TimeDeal.findAll", query="SELECT t FROM TimeDeal t")
public class TimeDeal implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@SequenceGenerator(name="TIME_DEAL_DEALID_GENERATOR", sequenceName="SEQ_50")
	@GeneratedValue(strategy=GenerationType.SEQUENCE, generator="TIME_DEAL_DEALID_GENERATOR")
	@Column(name="DEAL_ID")
	private long dealId;

	@Column(name="DEAL_CONTAIN")
	private String dealContain;

	//bi-directional many-to-one association to Complain
	@OneToMany(mappedBy="timeDeal")
	private List<Complain> complains;

	//bi-directional many-to-one association to CustomRecord
	@OneToMany(mappedBy="timeDeal")
	private List<CustomRecord> customRecords;

	public TimeDeal() {
	}
	
	
	public TimeDeal(long dealId, String dealContain) {
		super();
		this.dealId = dealId;
		this.dealContain = dealContain;  
	}
       

	public long getDealId() {
		return this.dealId;
	}
 
	public void setDealId(long dealId) {
		this.dealId = dealId;
	}

	public String getDealContain() {
		return this.dealContain;
	}

	public void setDealContain(String dealContain) {
		this.dealContain = dealContain;
	}

	public List<Complain> getComplains() {
		return this.complains;
	}

	public void setComplains(List<Complain> complains) {
		this.complains = complains;
	}

	public Complain addComplain(Complain complain) {
		getComplains().add(complain);
		complain.setTimeDeal(this);

		return complain;
	}

	public Complain removeComplain(Complain complain) {
		getComplains().remove(complain);
		complain.setTimeDeal(null);

		return complain;
	}

	public List<CustomRecord> getCustomRecords() {
		return this.customRecords;
	}

	public void setCustomRecords(List<CustomRecord> customRecords) {
		this.customRecords = customRecords;
	}

	public CustomRecord addCustomRecord(CustomRecord customRecord) {
		getCustomRecords().add(customRecord);
		customRecord.setTimeDeal(this);

		return customRecord;
	}

	public CustomRecord removeCustomRecord(CustomRecord customRecord) {
		getCustomRecords().remove(customRecord);
		customRecord.setTimeDeal(null);

		return customRecord;
	}


	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "TimeDeal [dealId=" + dealId + ", dealContain=" + dealContain + "]";
	}
	
}